<?php

//防止恶意调用
if (!defined('IN_MOD'))
{
    die('Hacking attempt');
}

// 栏目模块安装配置
if($configinfo['insertmodule'] == 1)
{
	// 后台栏目模块参数配置
	if($configinfo['columnmoduleconfigok'] == 1)
	{
		$modulewhere=array();
		$modulewhere['arrayclass'] = $configinfo['adminmoduleconfigcolumnid'];
		$modulewhere['where'] = $configinfo['post_status']."=1";
		$modulewhere['limit'] = "all";
		$modulewhere['order'] = "default";
		$modulewhere['langallok'] = 1;
		$moduleconfigdatalist = configmodule($modulewhere);
		if(!empty($moduleconfigdatalist))
		{
			$moduleconfigdatalistplugins = array();
			$moduleconfigdatalisttpl = array();
			foreach($moduleconfigdatalist as $key=>$val)
			{
				if($val['tplconfig'] == 1)
				{
					$moduleconfigdatalisttpl[] = $val;	
				}else{
					$moduleconfigdatalistplugins[] = $val;		
				}
			}
			$moduleconfigdatalistgroup = array_merge($moduleconfigdatalistplugins, $moduleconfigdatalisttpl);
			foreach($moduleconfigdatalistgroup as $key=>$val)
			{
				if($val['columnid'])
				{
					$paraconfig = array();
					if(!empty($val['modulename']))$paraconfig['module'] = $val['modulename'];
					if(!empty($val['datalist']))
					{
						foreach($val['datalist'] as $klist=>$vlist)
						{
							if(!empty($vlist['dataid']) && !empty($vlist['data']))
							{
								$vlist['data'] = deltrimall($vlist['data']);
								$dataarr = getstrtoarr(',', $vlist['data']);
								$data = array();
								foreach($dataarr as $ks=>$vs)
								{
									$vsgroup = getstrtoarr('|', $vs);
									$data[$vsgroup[0]] = $vsgroup[1];
								}
								$paraconfig['data'][$vlist['dataid']] = $data;
							}
						}
					}
					if(!empty($val['tpl']))
					{
						$tpl = getstrtoarr('|', $val['tpl']);
						$paraconfig['tpl'] = $tpl;
					}
					if(!empty($val['admintpl']))
					{
						$admintpl = getstrtoarr('|', $val['admintpl']);
						$paraconfig['admintpl'] = $admintpl;
					}
					if(!empty($val['para']))$paraconfig['para'] = $val['para'];
					if(!empty($val['morepara1']))$paraconfig['morepara1'] = $val['morepara1'];
					if(!empty($val['morepara2']))$paraconfig['morepara2'] = $val['morepara2'];
					if(!empty($val['morepara3']))$paraconfig['morepara3'] = $val['morepara3'];
					if(!empty($val['morepara4']))$paraconfig['morepara4'] = $val['morepara4'];
					if(!empty($val['morepara5']))$paraconfig['morepara5'] = $val['morepara5'];
					if(!empty($val['addpara']))$paraconfig['addpara'] = $val['addpara'];
					if(!empty($val['moreaddpara1']))$paraconfig['moreaddpara1'] = $val['moreaddpara1'];
					if(!empty($val['moreaddpara2']))$paraconfig['moreaddpara2'] = $val['moreaddpara2'];
					if(!empty($val['moreaddpara3']))$paraconfig['moreaddpara3'] = $val['moreaddpara3'];
					if(!empty($val['moreaddpara4']))$paraconfig['moreaddpara4'] = $val['moreaddpara4'];
					if(!empty($val['moreaddpara5']))$paraconfig['moreaddpara5'] = $val['moreaddpara5'];
					if(!empty($val['parafun']))$paraconfig['parafun'] = $val['parafun'];
					if(!empty($val['addparafun']))$paraconfig['addparafun'] = $val['addparafun'];
					if(!empty($val['sitepara']))$paraconfig['sitepara'] = $val['sitepara'];
					if(!empty($val['xcxsitepara']))$paraconfig['xcxsitepara'] = $val['xcxsitepara'];
					hook_configmodulepara($configinfo,$val['columnid'],$paraconfig,$val['tplconfig']);
					
					$paraotherconfig = array();
					if(!empty($val['attrlist']))
					{
						$attrlist = getstrtoarr('|', $val['attrlist']);
						$paraotherconfig['attrlist'] = $attrlist;
					}
					if(!empty($val['searchhtml']))$paraotherconfig['searchhtml'] = $val['searchhtml'];
					if(!empty($val['searchfield']))
					{
						$searchfieldarr = getstrtoarr(',', $val['searchfield']);
						$searchfield = array();
						foreach($searchfieldarr as $ks=>$vs)
						{
							$searchfield[$ks] = getstrtoarr('|', $vs);
						}
						$paraotherconfig['searchfield'] = $searchfield;
					}
					if(!empty($val['pname']))
					{
						$pnamearr = getstrtoarr(',', $val['pname']);
						$pname = array();
						foreach($pnamearr as $ks=>$vs)
						{
							$pname[$ks] = getstrtoarr('|', $vs);
						}
						$paraotherconfig['pname'] = $pname;
					}
					if(!empty($val['rpname']))
					{
						$rpnamearr = getstrtoarr(',', $val['rpname']);
						$rpname = array();
						foreach($rpnamearr as $ks=>$vs)
						{
							$rpname[$ks] = getstrtoarr('|', $vs);
						}
						$paraotherconfig['rpname'] = $rpname;
					}
					if(!empty($val['ptitle']))
					{
						$ptitlearr = getstrtoarr(',', $val['ptitle']);
						$ptitle = array();
						foreach($ptitlearr as $ks=>$vs)
						{
							$ptitle[$ks] = getstrtoarr('|', $vs);
						}
						$paraotherconfig['ptitle'] = $ptitle;
					}
					if(!empty($val['pvalue']))
					{
						$val['pvalue'] = deltrimall($val['pvalue']);// 删除所有回车空格等
						$pvaluearr = getstrtoarr('##', $val['pvalue']);
						$pvalue = array();
						foreach($pvaluearr as $ks=>$vs)
						{
							$vsgroup = getstrtoarr('@@', $vs);
							$fieldname = $vsgroup[0];
							$fielddata = $vsgroup[1];
							if(ifstr($fielddata,'**') == 1)
							{
								$fieldselect = getstrtoarr('**', $fielddata);
								foreach($fieldselect as $kf=>$vf)
								{
									$selectdata = getstrtoarr('|', $vf);
									$selectkey = $selectdata[0];
									$selectval = $selectdata[1];
									$pvalue[$fieldname][$selectkey]	 = $selectval;
								}
							}else{
								$pvalue[$fieldname]	 = $fielddata;
							}
						}
						$paraotherconfig['pvalue'] = $pvalue;
					}
					if(!empty($val['listdatahtml']))$paraotherconfig['listdatahtml'] = $val['listdatahtml'];
					if(!empty($val['listexphtml']))$paraotherconfig['listexphtml'] = $val['listexphtml'];
					if(!empty($val['contentexphtml']))$paraotherconfig['contentexphtml'] = $val['contentexphtml'];
					if(!empty($val['columnpara']))$paraotherconfig['columnpara'] = $val['columnpara'];
					if(!empty($val['feedbackok']))$paraotherconfig['feedbackok'] = $val['feedbackok'];
					if(!empty($val['parafieldpri']))
					{
						$val['parafieldpri'] = deltrimall($val['parafieldpri']);// 删除所有回车空格等
						$parafieldpriarr = getstrtoarr('##', $val['parafieldpri']);
						$parafieldpri = array();
						foreach($parafieldpriarr as $ks=>$vs)
						{
							$vsgroup = getstrtoarr('@@', $vs);
							$fieldname = $vsgroup[0];
							$fielddata = $vsgroup[1];
							$parafieldpri[$fieldname] = getstrtoarr('|', $fielddata);
						}
						$paraotherconfig['parafieldpri'] = $parafieldpri;
					}
					hook_configmoduleparaother($configinfo,$val['columnid'],$paraotherconfig,$val['tplconfig']);
					
					// 自定义模块独立表配置（多表自动获取当前模块表，不同模块调用不同数据表）
					$moduletable_module_group = array();
					$moduletable_module_group = $val['moduletable'];
					hook_configmoduleparamore($configinfo,"moduletable",$val['columnid'],$moduletable_module_group);
					// 后台文章模块默认字段开启配置
					$defaultfield = array();
					$listdeffield = array();
					$otherinfoconfig = array();
					if(!empty($val['articlefield']))
					{
						foreach($val['articlefield'] as $ks=>$vs)
						{
							// 支持值为字符串'0' != ''
							if($vs != '')
							{
								if(ifstr($ks,'defaultfield_'))
								{
									$newkey = delthstr($ks,'defaultfield_','');
									$defaultfield[$newkey] = $vs;
								}	
								if(ifstr($ks,'listdeffield_'))
								{
									$newkey = delthstr($ks,'listdeffield_','');	
									$listdeffield[$newkey] = $vs;
								}	
								if(ifstr($ks,'otherinfoconfig_'))
								{
									$newkey = delthstr($ks,'otherinfoconfig_','');	
									$otherinfoconfig[$newkey] = $vs;
								}	
							}
						}
					}
					$articlefield_module_group = array();
					$articlefield_module_group['defaultfield'] = array_merge($articlefield_module['default']['defaultfield'], $defaultfield);
					$articlefield_module_group['listdeffield'] = array_merge($articlefield_module['default']['listdeffield'], $listdeffield);
					$articlefield_module_group['otherinfoconfig'] = array_merge($articlefield_module['default']['otherinfoconfig'], $otherinfoconfig);
					hook_configmoduleparamore($configinfo,"articlefield",$val['columnid'],$articlefield_module_group);
					// 栏目参数配置
					$columnpara_module_group = array();
					$columnpara_module_group = $val['columnparamodule'];
					hook_configmoduleparamore($configinfo,"columnpara",$val['columnid'],$columnpara_module_group);
					// 单页面栏目跳转配置
					$dymconfig_module_group = array();
					$dymconfig_module_group = $val['dymconfig'];
					hook_configmoduleparamore($configinfo,"dymconfig",$val['columnid'],$dymconfig_module_group);
					// 模块公用开启配置
					$moduleconfig_module_group = array();
					$moduleconfig_module_group = $val['moduleconfig'];
					hook_configmoduleparamore($configinfo,"moduleconfig",$val['columnid'],$moduleconfig_module_group);
					// 内页左侧热门与推荐信息显示数量设置
					$hotrec_module_group = array();
					$hotrec_module_group = $val['hotrec'];
					hook_configmoduleparamore($configinfo,"hotrec",$val['columnid'],$hotrec_module_group);
					// 需要生成缩略图的字段配置
					$scthumb_module_group = array();
					$scthumb_module_group = $val['scthumb'];
					hook_configmoduleparamore($configinfo,"scthumb",$val['columnid'],$scthumb_module_group);
					// 自定义扩展配置
					$expmodule_module_group = array();
					$expmodule_module_group = $val['expmodule'];
					if(!empty($expmodule_module_group['parameter_attr_fieldok']))
					{
						$val['parameter_attr_fieldok'] = deltrimall($val['parameter_attr_fieldok']);// 删除所有回车空格等
						$parameter_attr_fieldokarr = getstrtoarr('#', $val['parameter_attr_fieldok']);
						$parameter_attr_fieldok = array();
						foreach($parameter_attr_fieldokarr as $ks=>$vs)
						{
							$vsgroup = getstrtoarr('|', $vs);
							$parameter_attr_fieldok[$vsgroup[0]] = $vsgroup[1];
						}
						$expmodule_module_group['parameter_attr_fieldok'] = $parameter_attr_fieldok;	
					}
					if(!empty($expmodule_module_group['parameter_attr_tablename']))
					{
						$val['parameter_attr_tablename'] = deltrimall($val['parameter_attr_tablename']);// 删除所有回车空格等
						$parameter_attr_tablenamearr = getstrtoarr(',', $val['parameter_attr_tablename']);
						$parameter_attr_tablename = array();
						foreach($parameter_attr_tablenamearr as $ks=>$vs)
						{
							$vsgroup = getstrtoarr('|', $vs);
							$parameter_attr_tablename[$vsgroup[0]] = $vsgroup[1];
						}
						$expmodule_module_group['parameter_attr_tablename'] = $parameter_attr_tablename;	
					}
					if(!empty($expmodule_module_group['parameter_attr_where']))
					{
						$val['parameter_attr_where'] = deltrimall($val['parameter_attr_where']);// 删除所有回车空格等
						$parameter_attr_wherearr = getstrtoarr(',', $val['parameter_attr_where']);
						$parameter_attr_where = array();
						foreach($parameter_attr_wherearr as $ks=>$vs)
						{
							$vsgroup = getstrtoarr('|', $vs);
							$parameter_attr_where[$vsgroup[0]] = $vsgroup[1];
						}
						$expmodule_module_group['parameter_attr_where'] = $parameter_attr_where;	
					}
					if(!empty($expmodule_module_group['parameter_attr_data']))
					{
						$val['parameter_attr_data'] = deltrimall($val['parameter_attr_data']);// 删除所有回车空格等
						$parameter_attr_dataarr = getstrtoarr('#', $val['parameter_attr_data']);
						$parameter_attr_data = array();
						foreach($parameter_attr_dataarr as $ks=>$vs)
						{
							$vsgroup = getstrtoarr('|', $vs);
							$parameter_attr_data[$vsgroup[0]] = $vsgroup[1];
						}
						$expmodule_module_group['parameter_attr_data'] = $parameter_attr_data;	
					}
					if(!empty($expmodule_module_group['parameter_attr_set']))
					{
						$val['parameter_attr_set'] = deltrimall($val['parameter_attr_set']);// 删除所有回车空格等
						$parameter_attr_setarr = getstrtoarr('#', $val['parameter_attr_set']);
						$parameter_attr_set = array();
						foreach($parameter_attr_setarr as $ks=>$vs)
						{
							$vsgroup = getstrtoarr('|', $vs);
							$parameter_attr_set[$vsgroup[0]] = $vsgroup[1];
						}
						$expmodule_module_group['parameter_attr_set'] = $parameter_attr_set;	
					}
					if(!empty($expmodule_module_group))
					{
						$exppara_module = array();
						foreach($expmodule_module_group as $ks=>$vs)
						{
							if(!empty($vs))
							{
								if(ifstr($ks,'exppara_'))
								{
									$newkey = delthstr($ks,'exppara_','');
									$exppara_module[$newkey] = $vs;
								}
							}
						}
						if(!empty($exppara_module))$expmodule_module_group = $exppara_module;
					}
					hook_configmoduleparamore($configinfo,"expmodule",$val['columnid'],$expmodule_module_group);
				}
			}
		}
	}
	
	// 模块多语言配置
	if($configinfo['langok'] == 1 && $configinfo['langdataok'] == 1)
	{
		// 获取数据库语言列表
		$defaultlang_name = getdesignatedname("defaultlang");
		$modulewhere=array();
		$modulewhere['arrayclass'] = $configinfo['langdatacolumnid'];
		$modulewhere['where'] = $configinfo['post_status']."=1";
		$modulewhere['limit'] = "all";
		$modulewhere['order'] = "default";
		$modulewhere['langallok'] = 1;
		$langdatalist = configmodule($modulewhere);
		if(!empty($langdatalist))
		{
			$langlist = array();
			$langall = array();
			$langfanyimark = array();
			$langdefault = $configinfo['langdefault'];
			foreach($langdatalist as $key=>$val)
			{
				$langlist[] = $val['langindex'];
				$langall[$val['langindex']] = $val[$configinfo['title']];
				$langfanyimark[$val['langindex']] = $val['fanyiindex'];
				if($val[$defaultlang_name] == 1)$langdefault = $val['langindex'];
			}
			$configinfo['langlist']	= $langlist;
			$configinfo['langall']	= $langall;
			$configinfo['langfanyimark'] = $langfanyimark;
			$configinfo['langdefault'] = $langdefault;
			
			// 多语言网站URL配置
			foreach($configinfo['langall'] as $key=>$val)
			{
				if($configinfo["langdefault"]==$key)
				{
					$configindex['indexurl'][$key] = $configinfo['weburl']."/";
				}else{
					$langhomeurl = $configinfo['langhomeurl'];
					$langhomeurl = str_replace("{lang}",$key,$langhomeurl);
					$configindex['indexurl'][$key] = $configinfo['weburl'].$langhomeurl;	
				}
			}
		}
	}
	
	// 栏目模块获取操作模块条件
	function getmodulewhere($moduleid=0,$type=1)
	{			
		// 普通模式
		if($type == 1)
		{
			$modulewhere = " and module = '".$moduleid."'";	
		}
		
		// THINKPHP模式
		if($type == 2)
		{
			$modulewhere['module'] = $moduleid;	
		}
		
		return $modulewhere;
	}

	// 模块标识配置
	$configinfo['indexnum'] = array(
									"indexnum_module" => "自定义模块", "indexnum_column" => "自定义栏目", "indexnum_exp" => "自定义扩展", 
									"indexnum_config" => "自定义配置", "indexnum_block" => "自定义区块", "indexnum_dym" => "自定义单页", 
									"indexnum_class" => "自定义分类", "indexnum_model" => "自定义模型", "indexnum_plugin" => "自定义插件"
								);

	// 模块配置信息
	if($configinfo['modulepara'] == 'pc' || $configinfo['modulepara'] == 'mobile')
	{
		if(!empty($configinfo['get_cat_id']) && $configinfo['listmodule'] == 1)
		{
			$config_columnid = intval($configinfo['get_cat_id']);
			$config_columnid = getparentclass3($config_columnid);// 当分类层级大于三级时只获取三级分类
		}
		if(!empty($configinfo['get_article_id']) && $configinfo['detailmodule'] == 1)
		{
			$config_dataid = intval($configinfo['get_article_id']);
			$config_columnid = intval($configinfo['get_article_cat_id']);
			$config_columnid = getparentclass3($config_columnid);// 当分类层级大于三级时只获取三级分类
				
			// 当前栏目ID为空时获取默认表中的当前数据所属的栏目ID
			if(empty($config_columnid))
			{
				$config_datainfo = datainfo($configinfo['ecs_article'],$config_dataid,$configinfo['article_id']);
				$config_columnid = $config_datainfo[$configinfo['article_cat_id']];		
			}
		}
		if($configinfo['defok'] == 1)
		{
			if($configinfo['listmodule'] == 1 || $configinfo['detailmodule'] == 1)
			{
				if(empty($config_columnid))
				{
					header("location: ".$configinfo['defaultmoduleurl']);
				}
			}
		}
	}
	if($configinfo['modulepara'] == 'admin')
	{
		if(!empty($configinfo['get_admin_cat_id']) && $configinfo['adminmodule'] == 1)
		{
			$config_columnid = intval($configinfo['get_admin_cat_id']);
			$config_columnid = getparentclass3($config_columnid);// 当分类层级大于三级时只获取三级分类
		}
		if(!empty($configinfo['get_admin_id']) && $configinfo['adminmodule'] == 1)
		{
			$config_dataid = intval($configinfo['get_admin_id']);
			$config_columnid = intval($configinfo['get_admin_cat_id']);
			$config_columnid = getparentclass3($config_columnid);// 当分类层级大于三级时只获取三级分类
				
			// 当前栏目ID为空时获取默认表中的当前数据所属的栏目ID
			if(empty($config_columnid))
			{
				$config_datainfo = datainfo($configinfo['ecs_article'],$config_dataid,$configinfo['article_id']);
				$config_columnid = $config_datainfo[$configinfo['article_cat_id']];		
			}
		}
		if($configinfo['defok'] == 1)
		{
			if($configinfo['adminmodule'] == 1)
			{
				if(empty($config_columnid))
				{
					header("location: ".$configinfo['defaultadminmoduleurl']);
				}
			}
		}
	}

	// 配置栏目模块
	$configinfo['columnid'] = 0;
	$configinfo['moduleid'] = 0;
	$configinfo['modulename'] = '';
	$configinfo['moduletopname'] = '';
	if(isset($config_columnid) && !empty($config_columnid))
	{
		// 栏目应用模块
		if($configinfo['modulepara'] != 'admin')
		{
			$configinfo['appmodule'] = 1;
		}
		
		// 后台栏目应用模块
		if($configinfo['modulepara'] == 'admin')
		{
			$configinfo['adminappmodule'] = 1;
		}
		
		// 当前模块
		$configinfo['themodule'] = "article";
		
		// 栏目ID
		$configinfo['columnid'] = $config_columnid;
			
		// 模块ID
		$configinfo['moduleid'] = gettopclass($configinfo["ecs_article_cat"], $config_columnid, $configinfo["cat_id"], $configinfo["parent_id"]);
		
		// 模块ID不存在时禁止访问
		if(empty($configinfo['moduleid']))
		{
			moduleerror(array("message"=>"Error:访问模块不存在或页面不存在！"));
		}
		
		// 模块信息
		$configinfo['moduleinfo'] = columninfo($configinfo['ecs_article_cat'],$configinfo['moduleid'],$configinfo['cat_id']);
		
		// 顶部ID
		$configinfo['moduletopid'] = gettopclass($configinfo["ecs_article_cat"], $config_columnid, $configinfo["cat_id"], $configinfo["parent_id"], 1);
		
		// 当前栏目
		$configinfo['columninfo'] = columninfo($configinfo['ecs_article_cat'],$config_columnid,$configinfo['cat_id']);
		
		// 上级栏目
		$configinfo['parentinfo'] = columninfo($configinfo['ecs_article_cat'],$configinfo['columninfo'][$configinfo['parent_id']],$configinfo['cat_id']);
		
		// 当前栏目的所有上级栏目
		$configinfo['moduleclass'] = getparentclass($configinfo["ecs_article_cat"],$config_columnid,$configinfo['cat_id'],$configinfo['parent_id']);
		
		// 当前层级栏目
		if(!empty($configinfo['moduleclass']['class1'][$configinfo['cat_id']]))$configinfo['column1id'] = $configinfo['moduleclass']['class1'][$configinfo['cat_id']];
		if(!empty($configinfo['moduleclass']['class2'][$configinfo['cat_id']]))$configinfo['column2id'] = $configinfo['moduleclass']['class2'][$configinfo['cat_id']];
		if(!empty($configinfo['moduleclass']['class3'][$configinfo['cat_id']]))$configinfo['column3id'] = $configinfo['moduleclass']['class3'][$configinfo['cat_id']];
		if(!empty($configinfo['moduleclass']['classtype']))$configinfo['columntype'] = $configinfo['moduleclass']['classtype'];
		if(!empty($configinfo['moduleclass']['class1']))$configinfo['column1info'] = $configinfo['moduleclass']['class1'];
		if(!empty($configinfo['moduleclass']['class2']))$configinfo['column2info'] = $configinfo['moduleclass']['class2'];
		if(!empty($configinfo['moduleclass']['class3']))$configinfo['column3info'] = $configinfo['moduleclass']['class3'];
		
		// 配置栏目ID
		$configinfo['topid'] = gettopid($configinfo['moduleid']);
		
		// 配置栏目信息
		$configinfo['topmodule'] = gettopmodule($configinfo['topid']);
		
		// 配置模块名
		$module_name_info = getclassinfo($configinfo["ecs_article_cat"], $configinfo['columnid'], $configinfo['cat_id'], $configinfo['parent_id'], 'module_name');
		$configinfo['modulename'] = $module_name_info['module_name'] ? $module_name_info['module_name'] : getmodulename($configinfo['moduleid']);
		$configinfo['moduletopname'] = $configinfo['moduleinfo']['module_name'] ? $configinfo['moduleinfo']['module_name'] : getmodulename($configinfo['moduleid']);
		
		// 自定义模型当前模块栏目信息
		if($configinfo['moduleinfo']['index_num'] == '自定义模型')
		{
			$modelConfig = datainfo($configinfo['ecs_article'],$configinfo['moduleid'],"attrid");
			$configinfo['modelok'] = 1;
			$configinfo['modelid'] = $configinfo['moduleid'];
			$configinfo['modeldataid'] = $modelConfig[$configinfo['article_id']];
			$configinfo['modelConfig'] = $modelConfig;
		}
		
		// 模块下的所有栏目
		$modulecolumn = getbottomclass($configinfo["ecs_article_cat"],$configinfo['moduleid'],$configinfo['cat_id'],$configinfo['parent_id']);
		$configinfo['modulecolumn'] = $modulecolumn['list'];
		$configinfo['modulecolumnids'] = $modulecolumn['ids'];
		
		// 栏目下的所有栏目
		$columnclass = getbottomclass($configinfo["ecs_article_cat"],$config_columnid,$configinfo['cat_id'],$configinfo['parent_id']);
		$configinfo['columnclass'] = $columnclass['list'];
		$configinfo['columnclassids'] = $columnclass['ids'];
		
		// 当前分类的栏目内容，为空时自动获取上级分类栏目内容
		if($configinfo['columncontentok'] == 1)
		{
			$configinfo['columncontent'] = getclassinfo($configinfo["ecs_article_cat"], $configinfo['columnid'], $configinfo['cat_id'], $configinfo['parent_id'], $configinfo['infofield']);
		}
		
		// 是否是系统配置与公用信息
		$configinfo['systemconfig'] = 0;// 当前为其它模块
		$configinfo['systemtype'] = "other";// 当前配置类型
		$zdyids = getstrtoarr(',',$configinfo['zdyid']);
		if(ifarraystr($zdyids,$configinfo['moduletopid']))
		{
			$configinfo['systemconfig'] = 1;// 系统配置与公信信息
			$systemtype = $configinfo['moduletopid'] == $configinfo['zdyconfig'] ? "config" : "block";
			$configinfo['systemtype'] = $systemtype;// 系统配置类型
			$configinfo['moduletopname'] = "system";// 定义系统模块名
		}
		
		// 模块多语言配置
		$configinfo['langmoduleok'] = 0;
		if($configinfo['langok'] == 1)
		{
			if(strpos($configinfo['langmodule'],$configinfo['moduleid']) !==false || $configinfo['langmodule'] == 'all')
			{
				$configinfo['langmoduleok'] = 1;// 模块语言开启
			}
		}
		
		// 获取语言关联栏目信息
		if($configinfo['columnattrok'] == 1)
		{
			// 当为后台时系统配置与公用信息的其它语言栏目信息不获取，使用默认语言
			if($configinfo['modulepara'] != 'admin' || ($configinfo['modulepara'] == 'admin' && $configinfo['systemconfig'] != 1))
			{
				if($configinfo['langok'] == 1)
				{
					// 栏目分类语言关联参数
					$configinfo['moduleinfo'] = modulelangcolumn($configinfo['moduleinfo'],$configinfo['moduleid']);
					$configinfo['parentinfo'] = modulelangcolumn($configinfo['parentinfo'],$configinfo['parentinfo'][$configinfo['cat_id']]);
					$configinfo['columninfo'] = modulelangcolumn($configinfo['columninfo'],$configinfo['columnid']);
				}
				
				// 栏目分类关联参数
				$configinfo['moduleattr'] = getattrparameter($configinfo['columnattrid'],$configinfo['moduleid']);
				$configinfo['parentattr'] = getattrparameter($configinfo['columnattrid'],$configinfo['parentinfo'][$configinfo['cat_id']]);
				$configinfo['columnattr'] = getattrparameter($configinfo['columnattrid'],$configinfo['columnid']);
			}
		}
		
		// 单页面子栏目
		if($configinfo['moduleinfo']['index_num'] == "自定义单页")
		{
			$modulewhere=array();
			$modulewhere['arrayclass'] = $configinfo['columnid'];
			$modulewhere['limit'] = "all";
			$modulewhere['order'] = "default";
			$modulewhere['where'] = $configinfo['post_status']."=1";
			$configinfo['dymcolumns'] = configmodule($modulewhere);
		}
		
		// 自定义模块参数开启时
		if($configinfo['zdypara'] == 1)
		{
			// 获取栏目自定义参数
			$configinfo['columnparameter'] = getcolumnattrparameter();// 获取栏目自定义参数
			
			// 获取栏目参数验证规则
			foreach($configinfo['columnparameter'] as $key=>$val)
			{
				if($val['codeqz'])
				{
					$configinfo['columnparametercodeqz'][] = stzhtml($val['codeqz']);
				}	
			}
			
			// 获取栏目搜索参数
			$configinfo['searchselectpara'] = getsearchselectpara();// 获取已选择搜索参数组
			$configinfo['searchparameterlist'] = getsearchparameterlist();// 获取栏目搜索参数列表
			$configinfo['searchparameterhtml'] = getsearchparameter();// 获取栏目搜索参数HTML
			$configinfo['searchparameterhtml2'] = getsearchparameter(1);// 获取后台栏目搜索参数HTML
		}
		
		// 更多链接
		$cat_id = 0;$attrid = 0;$listattrid = 0;$getlang = 0;$supplierdata = 0;$morepara = 0;
		if(isset($config_columnid))$cat_id = $config_columnid;
		if(moduleaqvarval('attrid','intval'))$attrid = moduleaqvarval('attrid','intval');
		if(moduleaqvarval('listattrid','intval'))$listattrid = moduleaqvarval('listattrid','intval');
		if(!empty($configinfo['lang']))$getlang = $configinfo['lang'];
		if(moduleaqvarval('supplierdata','intval'))$supplierdata = moduleaqvarval('supplierdata','intval');
		if(moduleaqvarval('morepara','string'))$morepara = moduleaqvarval('morepara','string');
		$moreurlmodel = $configinfo['moreurlmodel'];
		$moreurlmodel = str_replace("{cat_id}",$cat_id,$moreurlmodel);
		$moreurlmodel = str_replace("{attrid}",$attrid,$moreurlmodel);
		$moreurlmodel = str_replace("{listattrid}",$listattrid,$moreurlmodel);
		$moreurlmodel = str_replace("{lang}",$getlang,$moreurlmodel);
		$moreurlmodel = str_replace("{supplierdata}",$supplierdata,$moreurlmodel);
		$moreurlmodel = str_replace("{morepara}",$morepara,$moreurlmodel);
		$configinfo['moreurl'] = $moreurlmodel;
		
		// 获取URL更多参数数据
		$morepara = moduleaqvarval("morepara", "string");
		if(!empty($morepara))$configinfo['morepara'] = getjsonarr(stzhtml($morepara));	
		
		// 上传文件模块调用链接配置
		$configinfo['uploadphpurl'] = $configinfo['uploadphpurl']."?moduletopname=article_".$configinfo['moduletopname'];
		$configinfo['uploadconfig_module']['article']['phpurl'] = $configinfo['uploadconfig_module']['article']['phpurl']."?moduletopname=article_".$configinfo['moduletopname'];
	}
	
	// 当访问栏目应用模块程序时
	if(($configinfo['listmodule'] == 1 || $configinfo['detailmodule'] == 1 || $configinfo['adminmodule'] == 1))
	{
		// 模块ID不存在
		if(empty($configinfo['moduleid']))
		{
			moduleerror(array("message"=>"Error:当前未知模块ID！模块参数安装失败！请先安装！"));
		}
	}
}

// 扩展商家功能（三种类型情况下的商家模块配置）
// 独立商家 $configinfo['modulepara'] == "supplier"
// 前台商家 $configinfo['suppliermodule'] == 1
// 后台商家 $configinfo['adminsuppliermodule'] == 1
if($configinfo['expsupplier_ok'] == 1)
{
	// 初始化商家ID
	global $supplier_id;
	$supplier_id = $configinfo['supplier_id'] = 0;
	
	// 前台扩展功能配置
	$actopsupplier = $_MGPC_GET['act'];
	if($actopsupplier == "supplier")$configinfo['suppliermodule'] = 1;
	if($configinfo['modulepara'] == "supplier" || $configinfo['suppliermodule'] == 1)
	{		
		// 访问模块权限判断
		$expsupplier_usermodule = getstrtoarr(",",$configinfo['expsupplier_usermodule']);
		if(ifarraystr($expsupplier_usermodule,$configinfo['moduleid']) == 1 || $configinfo['themodule'] != "article")
		{
			// 配置商家ID
			if($configinfo['expsupplier_uid'])
			{
				$supplier_id = $configinfo['supplier_id'] = $configinfo['expsupplier_uid'];
			}
		}else{
			moduleerror(array("message"=>"非法操作！当前模块不存在！","url"=>$configinfo['expsupplier_centerurl']));	
		}
		
		// 检测是否登录
		if(empty($supplier_id))
		{
			moduleerror(array("message"=>"请先登录商家！","url"=>$configinfo['expsupplier_loginurl']));
		}
		
		// 商家操作数据权限（只允许操作自己的数据，限制非法操作其它商家的数据）
		if($configinfo['listmodule'] == 1 || $configinfo['detailmodule'] == 1)
		{
			// 单数据操作商家权限
			if($configinfo['get_article_actid'])
			{
				$supplierop = supplieropdataok($configinfo['get_article_actid'],1,$configinfo['ecs_article'],$configinfo['article_id']);
				if($supplierop == 0)
				{
					$modulehook = "errortip";$tipcontent = "非法操作！商家只能操作自己的数据！";require(MODULEPARA_PATH . 'config/modulehook.php');// 调用系统提示钩子	
				}
			}
			// 批量数据操作商家权限
			if(is_array($configinfo['get_article_opids']))
			{
				$supplierop = supplieropdataok($configinfo['get_article_opids'],2,$configinfo['ecs_article'],$configinfo['article_id']);
				if($supplierop == 0)
				{
					$modulehook = "errortip";$tipcontent = "非法操作！商家只能操作自己的数据！";require(MODULEPARA_PATH . 'config/modulehook.php');// 调用系统提示钩子	
				}	
			}
		}
		
		// 商家其它模块操作数据权限（只允许操作自己的数据，限制非法操作其它商家的数据）
		if($configinfo['themodule'] && $configinfo['themodule'] != "article")
		{
			$modulehook = "supplierdataok";$opmoduleid = $configinfo['themodule'];require(MODULEPARA_PATH . 'config/modulehook.php');// 调用系统提示钩子
		}
		
		// 商家其它模块操作数据权限条件（只允许操作自己的数据，限制非法操作其它商家的数据）
		function suppliersupplierwhere($prefix="")
		{
			$supplierwhere = array();
			$supplierwhere[1] = getsupplierwhere(1,$prefix);	
			$supplierwhere[2] = getsupplierwhere(2,$prefix);	
			$supplierwhere[3] = getsupplierwhere(3,$prefix);
			
			return $supplierwhere;
		}
		
		// 商家允许投稿栏目权限（允许发布和修改栏目数据）
		if($configinfo['expsupplier_updatecolumn'] && supplierpostcolumndataok($configinfo['expsupplier_updatecolumn']) == 0)
		{
			$modulehook = "errortip";$tipcontent = "非法操作！当前投稿模块不存在！";require(MODULEPARA_PATH . 'config/modulehook.php');// 调用系统提示钩子
		}
	}
	
	// 后台扩展功能配置
	if($configinfo['modulepara'] == "admin")
	{
		global $hook_supplierexpok,$hook_supplierexpuid;

		if($hook_supplierexpok == 1 && $configinfo['adminsuppliermodule'] == 1)
		{
			if($configinfo['themodule'])
			{
				// 获取设置当前模块
				$themodule = $configinfo['themodule'];
				if($configinfo['themodule'] == "article")
				{
					$themodule = $configinfo['moduleid'];	
				}
				
				// 访问模块权限判断
				$expsupplier_module = getstrtoarr(",",$configinfo['expsupplier_module']);
				if(ifarraystr($expsupplier_module,$themodule) == 1)
				{
					$supplier_id = $configinfo['supplier_id'] = $hook_supplierexpuid;
				}else{
					// 【模块参数程序安装】配置商家扩展功能引入文件（可选）
					$modulehook = "expsupplier";$hookblock = "platformadminqx";require(MODULEPARA_PATH . 'config/modulehook.php');
				}
			}else{
				// 【模块参数程序安装】配置商家扩展功能引入文件（可选）
				$modulehook = "expsupplier";$hookblock = "platformadminqx";require(MODULEPARA_PATH . 'config/modulehook.php');	
			}
			
			// 商家操作数据权限（只允许操作自己的数据，限制非法操作其它商家的数据）
			if($configinfo['adminmodule'] == 1)
			{
				// 单数据操作商家权限
				if($configinfo['get_admin_actid'])
				{
					$supplierop = supplieropdataok($configinfo['get_admin_actid'],1,$configinfo['ecs_article'],$configinfo['article_id']);
					if($supplierop == 0)
					{
						$modulehook = "errortip";$tipcontent = "非法操作！商家只能操作自己的数据！";require(MODULEPARA_PATH . 'config/modulehook.php');// 调用系统提示钩子		
					}
				}
				// 批量数据操作商家权限
				if(is_array($configinfo['get_admin_opids']))
				{
					$supplierop = supplieropdataok($configinfo['get_admin_opids'],2,$configinfo['ecs_article'],$configinfo['article_id']);
					if($supplierop == 0)
					{
						$modulehook = "errortip";$tipcontent = "非法操作！商家只能操作自己的数据！";require(MODULEPARA_PATH . 'config/modulehook.php');// 调用系统提示钩子			
					}	
				}
			}
			
			// 商家其它模块操作数据权限（只允许操作自己的数据，限制非法操作其它商家的数据）
			if($configinfo['themodule'] && $configinfo['themodule'] != "article")
			{
				$modulehook = "adminsupplierdataok";$opmoduleid = $configinfo['themodule'];require(MODULEPARA_PATH . 'config/modulehook.php');// 调用系统提示钩子
			}
			
			// 商家其它模块操作数据权限条件（只允许操作自己的数据，限制非法操作其它商家的数据）
			function adminsupplierwhere($prefix="")
			{
				$supplierwhere = array();
				$supplierwhere[1] = getsupplierwhere(1,$prefix);	
				$supplierwhere[2] = getsupplierwhere(2,$prefix);	
				$supplierwhere[3] = getsupplierwhere(3,$prefix);
				
				return $supplierwhere;
			}
		}
	}
}

// 模块公用开启配置
if($configinfo['moduleconfigok'] == 1 && ($configinfo['appmodule'] == 1 || $configinfo['adminappmodule'] == 1))
{
	$topmodule_moduleconfig = gettopmodule($configinfo['moduleid'],"moduleconfig");
	$configbase['tagok'] = $topmodule_moduleconfig['tagok'];// TAG标签配置
	$configbase['commentok'] = $topmodule_moduleconfig['commentok'];// 评论管理配置
	$configbase['columnparaok'] = $topmodule_moduleconfig['columnparaok'];// 栏目参数配置
	$configbase['shopparaok'] = $topmodule_moduleconfig['shopparaok'];// 商品参数配置
	$configbase['payok'] = $topmodule_moduleconfig['payok'];// 付费阅读配置
}

// 获取缩略图后台配置数据
if($configinfo['thumbok'] == 1 && $configinfo['adminappmodule'] == 1)
{
	$thumbconfig = getthumbconfig();
	if(ifarray($thumbconfig))
	{
		$configinfo["src"]['thumb_width'] = $thumbconfig['thumb_width'];	
		$configinfo["src"]['thumb_height'] = $thumbconfig['thumb_height'];	
		$configinfo["src"]['thumb_type'] = $thumbconfig['thumb_type'];	
		$configinfo["src"]['big_width'] = $thumbconfig['big_width'];	
		$configinfo["src"]['big_height'] = $thumbconfig['big_height'];	
		$configinfo["src"]['big_type'] = $thumbconfig['big_type'];	
	}
}

// 内页左侧热门与推荐信息显示数量设置
if($configinfo['hotrecok'] == 1 && $configinfo['appmodule'] == 1)
{
	$topmodule_hotrec = gettopmodule($configinfo['moduleid'],"hotrec");
	$configbase['hotshow'] = $topmodule_hotrec['hotshow'];
	$configbase['recshow'] = $topmodule_hotrec['recshow'];
	$hotshowmodule = $topmodule_hotrec['hotshowmodule'];
	$configbase['hotshowmodule'] = $hotshowmodule ? $hotshowmodule : $configinfo['moduleid'];
	$recshowmodule = $topmodule_hotrec['recshowmodule'];
	$configbase['recshowmodule'] = $recshowmodule ? $recshowmodule : $configinfo['moduleid'];
	$configbase['hotshownum'] = $topmodule_hotrec['hotshownum'];
	$configbase['recshownum'] = $topmodule_hotrec['recshownum'];
	if($configinfo['detailmodule'] == 1)
	{
		$configbase['hotshow'] = $topmodule_hotrec['detail_hotshow'];
		$configbase['recshow'] = $topmodule_hotrec['detail_recshow'];
		$hotshowmodule = $topmodule_hotrec['detail_hotshowmodule'];
		$configbase['hotshowmodule'] = $hotshowmodule ? $hotshowmodule : $configinfo['moduleid'];
		$recshowmodule = $topmodule_hotrec['detail_recshowmodule'];
		$configbase['recshowmodule'] = $recshowmodule ? $recshowmodule : $configinfo['moduleid'];
		$configbase['hotshownum'] = $topmodule_hotrec['detail_hotshownum'];
		$configbase['recshownum'] = $topmodule_hotrec['detail_recshownum'];	
	}
}

// 网站过期时间
if($configinfo['websiteok'] == 1)
{
	// 网站开始时间
	if(!empty($configsystem['systemconfig']['website_starttime']))
	{
		$configinfo['website_starttime'] = $configsystem['systemconfig']['website_starttime'];
	}
	
	// 网站结束时间
	if(!empty($configsystem['systemconfig']['website_endtime']))
	{
		$configinfo['website_endtime'] = $configsystem['systemconfig']['website_endtime'];
	}
}

// 新增是否开启测试配置信息 DATE:2020-5-2
if($configinfo['testconfigok'] != 1)
{
	$configinfo['testconfigshow'] = 'display:none!important;';
}
?>